package com.example.demo.controller;

import com.example.demo.entity.UserEntity;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired  // 控制器调用服务层，所以需要将服务层的属性注入
    private UserService userService;

    @RequestMapping("/getall")
    public List<UserEntity> getAll() {
        return userService.getAll();
    }
}
